package ar.unlam.com.cliente;

import java.awt.Font;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;

@SuppressWarnings("rawtypes")
public class PantallaRecuperarContrasena {	
	private JFrame frame;
	private JTextField usuarioRecuperarTextField;
	private JPasswordField nuevaPasswordTextField;
	private JPasswordField confirmarPasswordTextField;
	private JTextField preguntaSecretaTextField;	
	private JLabel lblRegistrarseAqui; 
	private JComboBox comboBox; 
	private JButton recuperarButton;

	public PantallaRecuperarContrasena(){
		initialize();
	}
	
	private void initialize(){		
		/* Cuarta Pantalla*/
		frame = new JFrame();
		frame.setResizable(false);
		frame.setTitle("Recuperacion de Contrasena");
		frame.setBounds(100, 100, 700, 600);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		

		VerificadorInputs viRespuesta	= new VerificadorInputs("String",100);
		VerificadorInputs viUsuario		= new VerificadorInputs("Alfanumerico",12);
		VerificadorInputs viPassword	= new VerificadorInputs("Password",12);
		
		usuarioRecuperarTextField = new JTextField("");
		usuarioRecuperarTextField.setColumns(10);	
		usuarioRecuperarTextField.setInputVerifier(viUsuario);
		usuarioRecuperarTextField.addActionListener(viUsuario);
		usuarioRecuperarTextField.addFocusListener(viUsuario);	
		
		nuevaPasswordTextField = new JPasswordField();
		nuevaPasswordTextField.setColumns(10);
		nuevaPasswordTextField.setInputVerifier(viPassword);
		nuevaPasswordTextField.addActionListener(viPassword);
		nuevaPasswordTextField.addFocusListener(viPassword);
		
		confirmarPasswordTextField = new JPasswordField();
		confirmarPasswordTextField.setColumns(10);
		confirmarPasswordTextField.setInputVerifier(viPassword);
		confirmarPasswordTextField.addActionListener(viPassword);
		confirmarPasswordTextField.addFocusListener(viPassword);
		
		preguntaSecretaTextField = new JTextField();
		preguntaSecretaTextField.setColumns(10);
		preguntaSecretaTextField.setInputVerifier(viRespuesta);
		preguntaSecretaTextField.addActionListener(viRespuesta);
		preguntaSecretaTextField.addFocusListener(viRespuesta);
		
		JLabel lblUsuario = new JLabel("Usuario");		
		JLabel lblNuevaContrasena = new JLabel("Nueva Contrasena");		
		JLabel lblConfirmarContrasena = new JLabel("Confirmar Contrasena");
		lblRegistrarseAqui = new JLabel("*Si aun no tiene un usuario, debe registrarse haciendo click Aqui.");
		JLabel lblNewLabel = new JLabel("Para recuperar su contrasena, por favor responda las preguntas de seguridad");
		lblNewLabel.setFont(new Font("Dialog", Font.BOLD, 16));

		recuperarButton = new JButton("Recuperar");
		comboBox = new JComboBox();
		
		GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(26)
					.addComponent(lblNewLabel)
					.addContainerGap(31, Short.MAX_VALUE))
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(272)
					.addComponent(recuperarButton)
					.addContainerGap(283, Short.MAX_VALUE))
				.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
					.addContainerGap(128, Short.MAX_VALUE)
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
						.addComponent(lblRegistrarseAqui, GroupLayout.PREFERRED_SIZE, 376, GroupLayout.PREFERRED_SIZE)
						.addGroup(groupLayout.createSequentialGroup()
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(lblUsuario)
								.addComponent(lblNuevaContrasena)
								.addComponent(lblConfirmarContrasena)
								.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE))
							.addGap(39)
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(confirmarPasswordTextField, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
								.addComponent(nuevaPasswordTextField, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
								.addComponent(usuarioRecuperarTextField, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
								.addComponent(preguntaSecretaTextField, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE))))
					.addGap(127))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(46)
					.addComponent(lblNewLabel)
					.addGap(75)
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
						.addComponent(usuarioRecuperarTextField, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblUsuario))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
						.addComponent(nuevaPasswordTextField, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblNuevaContrasena))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
						.addComponent(confirmarPasswordTextField, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblConfirmarContrasena))
					.addGap(42)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(preguntaSecretaTextField, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
						.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(39)
					.addComponent(recuperarButton)
					.addPreferredGap(ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
					.addComponent(lblRegistrarseAqui, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
					.addGap(29))
		);
		
		frame.getContentPane().setLayout(groupLayout);		
		frame.setVisible(true);		
	}

	public JFrame getFrmRecuperacionDeContrasea() {
		return frame;
	}

	public void setFrmRecuperacionDeContrasea(JFrame frmRecuperacionDeContrasea) {
		this.frame = frmRecuperacionDeContrasea;
	}

	public JTextField getUsuarioRecuperarTextField() {
		return usuarioRecuperarTextField;
	}

	public void setUsuarioRecuperarTextField(JTextField usuarioRecuperarTextField) {
		this.usuarioRecuperarTextField = usuarioRecuperarTextField;
	}

	public JPasswordField getNuevaPasswordTextField() {
		return nuevaPasswordTextField;
	}

	public void setNuevaPasswordTextField(JPasswordField nuevaPasswordTextField) {
		this.nuevaPasswordTextField = nuevaPasswordTextField;
	}

	public JPasswordField getConfirmarPasswordTextField() {
		return confirmarPasswordTextField;
	}

	public void setConfirmarPasswordTextField(
			JPasswordField confirmarPasswordTextField) {
		this.confirmarPasswordTextField = confirmarPasswordTextField;
	}

	public JTextField getPreguntaSecretaTextField() {
		return preguntaSecretaTextField;
	}

	public void setPreguntaSecretaTextField(JTextField preguntaSecretaTextField) {
		this.preguntaSecretaTextField = preguntaSecretaTextField;
	}

	public JComboBox getComboBox() {
		return comboBox;
	}

	public void setComboBox(JComboBox comboBox) {
		this.comboBox = comboBox;
	}

	public void setVisible(boolean b) {
		this.frame.setVisible(b);
	}

	public JFrame getFrame() {
		return frame;
	}

	public void setFrame(JFrame frame) {
		this.frame = frame;
	}

	public JLabel getLblRegistrarseAqui() {
		return lblRegistrarseAqui;
	}

	public void setLblRegistrarseAqui(JLabel lblRegistrarseAqui) {
		this.lblRegistrarseAqui = lblRegistrarseAqui;
	}

	public JButton getRecuperarButton() {
		return recuperarButton;
	}

	public void setRecuperarButton(JButton recuperarButton) {
		this.recuperarButton = recuperarButton;
	}
	
}
